home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group92c.txt
/
000012_icon-group-sender _Tue Oct 6 13:12:00 1992.msg
< prev
next >
Wrap
Internet Message Format
|
1993-01-04
|
2KB
Received: by cheltenham.cs.arizona.edu; Tue, 6 Oct 1992 10:22:54 MST
Date: Tue, 6 Oct 92 13:12:00 EDT
From: Paul_Abrahams@MTS.cc.Wayne.edu
To: icon-group@cs.arizona.edu
Message-Id: <508918@MTS.cc.Wayne.edu>
Subject: Logging out from Unix using an Icon program
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Chris Tenaglia asks:
> If I have a simple abc menu that looks something like :
>
> M : MAIL
> C : CHANGE PASSWORD
> L : LOGOUT
>
> Is there a way to log out cleanly. Unix seems to pop processes out all over
> the place. I use icon 8.7 under ultrix 4.2a. My background is chiefly VMS.
> There's probably a real simple answer I can't see because of my background.
I haven't been following all the replies to this question closely, but I've
noticed several suggestions for using 'kill'. That seems to me to be a
meat-cleaver approach.
I'll assume that the context is that you're writing an Icon program to
serve as a replacement login shell. (In non-Unixspeak, you're writing
an Icon program that takes over when a user logs in and enables the user
to carry out operations such as reading mail, changing hisorher password,
and eventually logging out.)
Under this assumption, there *is* a simple answer: call the program from
your initialization file (.profile for the Bourne or Korn shells, .cshrc
for the C shell) using the 'exec' command. The program will then replace
the executing shell as your outermost process. When you exit from the
Icon program, you'll also log out. Therefore, just tie the 'L' item in
your menu to the Icon 'exit' function.
Another strategy is to use a Bourne shell function or the C shell 'source'
command with a little script that tests the exit code of the Icon program
and does an exit if that code has a certain distinguished value. However,
I don't know of any advantages that this method has over the simple one.
Direct execution as provided by Bourne shell functions and C shell 'source'
is essential; if you try this from a shell script, you'll merely exit
from the script.
Unix makes it very difficult to log out from a nested shell, deliberately
so. You have to find your top-level process and kill it. I assume that
for your purposes you don't have to log out from a nested shell.
Paul Abrahams